home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks96 / MenuMadness.sit / MenuMadness / Source / C Source / Main.c < prev    next >
C/C++ Source or Header  |  1996-06-21  |  960b  |  69 lines

  1. #include <A4Stuff.h>
  2. #include <Traps.h>
  3. #include "MenuSelect.h"
  4. //#include "ShowIconFamily.h"
  5.  
  6. OSErr    InstallPatches(void);
  7. pascal void main(void);
  8. pascal long    MenuSelectPatch(Point    where);
  9.  
  10.  
  11.  
  12. enum{kINITID = 0 };
  13.  
  14.  
  15.  
  16. pascal void main(void)
  17. {
  18.     long    oldA4;
  19.     Handle    h = Get1Resource('INIT', kINITID);
  20.     OSErr    result = noErr;
  21.  
  22.     if (h == nil)
  23.         return;
  24.         
  25.     DetachResource(h);
  26.     
  27.     oldA4 = SetCurrentA4();
  28.     
  29.     result = InstallPatches();
  30.     
  31.     SetA4(oldA4);
  32.     
  33.     
  34.     /*if (result != noErr)
  35.         ShowIconFamily(129);
  36.     else
  37.         ShowIconFamily(128);*/
  38.         
  39. }
  40.  
  41. long    gOriginalMenuSelectAddress = 0;
  42.  
  43. OSErr    InstallPatches(void)
  44. {
  45.     OSErr    result = noErr;
  46.     
  47.     gOriginalMenuSelectAddress = (long) GetToolTrapAddress(_MenuSelect);
  48.     SetToolTrapAddress( (UniversalProcPtr)MenuSelectPatch, _MenuSelect);
  49.     
  50.     
  51.     return result;
  52. }
  53.  
  54.  
  55.  
  56. pascal long    MenuSelectPatch(Point    where)
  57. {
  58.     long    oldA4 = SetCurrentA4();
  59.     
  60.     long    result = AltMenuSelect(where, kFXSlide, kFXZoomIn);
  61.         
  62.     SetA4(oldA4);
  63.  
  64.     return result;
  65. }
  66.  
  67.  
  68.  
  69.